home *** CD-ROM | disk | FTP | other *** search
- program Label_;
- uses
- CRT,DOS,VOL;
-
- procedure PressKey;
- var
- ch : Char;
- begin
- write ('Press any key ...');
- ch:= ReadKey;
- If ch = #0 then ch:= ReadKey;
- writeln
- end;
-
-
- procedure AV (Dr:Drive; V:VolumeName);
- begin
- If AddVol (Dr, V) then
- writeln ('New Volume Label Added.')
- else
- writeln ('ERROR Adding New Label.')
- end;
-
-
- procedure CV (Dr:Drive; V:VolumeName);
- begin
- if ChgVol (Dr, V) then
- writeln ('Volume Label Changed.')
- else
- writeln ('ERROR Changing Label.')
- end;
-
-
- procedure DV (Dr:Drive);
- begin
- If DelVol (Dr) then
- writeln ('Volume Label Deleted.')
- else
- writeln ('ERROR Deleting Label.')
- end;
-
- (* MAIN PROGRAM *)
- var
- Dr : Drive;
- D : string[2];
- V : VolumeName;
- OV : VolumeName;
- RD : char;
- Exists : boolean;
- begin
- writeln;
- writeln;
- if ParamCount = 0 then
- begin
- repeat
- write ('Drive: ');
- D:= upcase (readkey);
- if D = #27 then
- D:= #64
- until D [1] in [#64..#97];
- end
- else
- D:= ParamStr(1);
- Dr:= ord (upcase (D [1])) - 64;
- if Dr in [1..26] then
- begin
- if ParamCount = 0 then
- writeln (D, ':');
- V:= GetVol (Dr);
- Exists:= V <> '';
- if Exists then
- begin
- writeln ('Current label of drive ', D,' is ', V);
- writeln ('R)elabel, D)elete, or [Esc]?')
- end
- else
- begin
- writeln ('Drive ', D,' has no label');
- writeln ('write new label? [Y/N]')
- end;
- RD:= upcase (readkey);
- if RD in ['R','Y'] then
- begin
- if ParamCount = 2 then
- V:= ParamStr (2)
- else
- begin
- write ('New Volume Label (max 11 chars): ');
- readln (V)
- end;
- writeln;
- if Length (V) > 0 then
- if Exists then
- CV (Dr, V)
- else
- AV (Dr, V)
- end
- else
- if Exists and (RD = 'D') then
- DV (Dr);
- if (RD <> #27)
- and (V <> '') then
- begin
- writeln;
- PressKey
- end
- end
- end.